/****** Object:  Stored Procedure [dbo].sporderInsert Script Date: 11/24/2012 ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[sporderInsert]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
	DROP PROCEDURE [dbo].[sporderInsert]
GO

/******************************************************************************
**		Name: [dbo].sporderInsert
**		Desc:
**
**		Return values:
**
**		Called by:
**
**		Parameters:
**		Input						Output
**		----------					----------
**
**		Auth: MinhSong
**		Date: 11/24/2012
*******************************************************************************
**		Change History
*******************************************************************************
**		Date:		Author:					Description:
**		--------	--------				-----------------------------------
**
*******************************************************************************/

CREATE PROCEDURE [dbo].[sporderInsert]
(
	@StoreID int,
	@ReciverName nvarchar(50),
	@PhoneNumber nchar(20),
	@Address1 nvarchar(100),
	@Address2 nvarchar(100),
	@CreateBy nvarchar(50),
	@UpdateBy nvarchar(50),
	@Customer nvarchar(50),
	@OrderID int output
)
WITH ENCRYPTION

AS

SET NOCOUNT ON

INSERT INTO [tbl_order]
(
	[StoreID],
	[ReciverName],
	[PhoneNumber],
	[Address1],
	[Address2],
	[CreateBy],
	[CreateDate],
	[UpdateBy],
	[UpdateDate],
	[Customer]
)
VALUES
(
	@StoreID,
	@ReciverName,
	@PhoneNumber,
	@Address1,
	@Address2,
	@CreateBy,
	getdate(),
	@UpdateBy,
	getdate(),
	@Customer
)

SELECT @OrderID = SCOPE_IDENTITY()
--SELECT @Id = @@IDENTITY
GO

--GRANT EXECUTE ON [dbo].[sporderInsert] TO [sa]
--GO
